Skip to content

Conversation

@kentcdodds
Copy link
Member

Gracefully handle malformed URI errors in client hint cookies and prevent infinite page reloads.


Open in Cursor Open in Web

@cursor
Copy link

cursor bot commented Aug 16, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@kentcdodds kentcdodds marked this pull request as ready for review August 16, 2025 21:22
src/index.ts Outdated
// Handle malformed URI gracefully by falling back to null
// This prevents crashes and allows the hint's fallback value to be used
console.warn(
`Failed to decode cookie value for ${hint.cookieName}: ${error}`,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cursor, could we move the error to a second argument so we don't only get the toString but can also get the stack trace?

@kentcdodds kentcdodds merged commit 8448468 into main Aug 16, 2025
4 checks passed
@kentcdodds kentcdodds deleted the cursor/handle-malformed-uri-error-in-cookies-d949 branch August 16, 2025 21:29
@github-actions
Copy link

🎉 This PR is included in version 1.3.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants